<template>
  <div>
    <div class="home">
      <!-- 搜索框 -->
      <van-search  show-action  placeholder="搜索课程" >
        <template #action>
          <div style="font-size: 14px; color: #4c4c4c; font-weight: bold; position: relative; left:8px">我的课程</div>
        </template>
      </van-search>

      <!-- 分类导航 -->
      <van-tabs>
        <van-tab v-for="(index, i) in 8" :key="i" :title="'标签 ' + index">
          <!-- 内容 {{ index }} -->
        </van-tab>
      </van-tabs>
    </div>

      <!-- 轮播 -->
      <van-swipe :autoplay="3000" indicator-color="red" class="lb">
        <van-swipe-item class="lbz" v-for="(image, index) in images" :key="index">
          <img v-lazy="image" class="lbtp" />
        </van-swipe-item>
      </van-swipe>

    <div class="zht">
      <!-- 横排展示 -->
      <van-cell-group>
        <van-cell value="查看全部">
          <template #title>
            <span class="custom-title">元气早餐</span>
          </template>
        </van-cell>
        <div class="tp">
          <div v-for="(item, index) in imgList" :key="index" class="ttp">
            <img :src="item.img" alt="" />
            <!-- 在学人数 -->
            <div class="rs">
              <span>1000+</span>
              <span>在学</span>
            </div>
            <!-- 描述文字 -->
            <div class="miaoshu">皮薄汁多馅料美： 秒杀狗不理包子的[完美灌汤包]</div>
          </div>
        </div>

        <van-cell value="查看全部">
          <template #title>
            <span class="custom-title">私房必做</span>
          </template>
        </van-cell>
        <div class="tp">
          <div v-for="(item, index) in imgList" :key="index" class="ttp">
            <img :src="item.img" alt="" />
            <div class="rs">
              <span>1000+</span>
              <span>在学</span>
            </div>
            <div class="miaoshu">低糖低脂代餐极: 5款爆款手工软欧包</div>
          </div>
        </div>

        <van-cell value="查看全部">
          <template #title>
            <span class="custom-title">下午茶时光</span>
          </template>
        </van-cell>
        <div class="tp">
          <div v-for="(item, index) in imgList" :key="index" class="ttp">
            <img :src="item.img" alt="" />
            <div class="rs">
              <span>1000+</span>
              <span>在学</span>
            </div>
            <div class="miaoshu">低糖低脂代餐极: 5款爆款手工软欧包</div>
          </div>
        </div>

        <van-cell value="查看全部">
          <template #title>
            <span class="custom-title">基础经典</span>
          </template>
        </van-cell>
        <div class="tp">
          <div v-for="(item, index) in imgList" :key="index" class="ttp">
            <img :src="item.img" alt="" />
            <div class="rs">
              <span>1000+</span>
              <span>在学</span>
            </div>
            <div class="miaoshu">低糖低脂代餐极: 5款爆款手工软欧包</div>
          </div>
        </div>

        <van-cell value="查看全部">
          <template #title>
            <span class="custom-title">技法装饰</span>
          </template>
        </van-cell>
        <div class="tp">
          <div v-for="(item, index) in imgList" :key="index" class="ttp">
            <img :src="item.img" alt="" />
            <div class="rs">
              <span>1000+</span>
              <span>在学</span>
            </div>
            <div class="miaoshu">低糖低脂代餐极: 5款爆款手工软欧包</div>
          </div>
        </div>

        <van-cell>
          <template #title>
            <span class="custom-title">亦爱料理</span>
          </template>
        </van-cell>
        <div class="tp">
          <div v-for="(item, index) in imgList" :key="index" class="ttp">
            <img :src="item.img" alt="" />
            <div class="rs">
              <span>1000+</span>
              <span>在学</span>
            </div>
            <div class="miaoshu">低糖低脂代餐极: 5款爆款手工软欧包</div>
          </div>
        </div>
      </van-cell-group>

      <!-- 灰色分隔线 -->
      <hr style="border: 5px solid rgb(240, 240, 240)" />

      <van-empty class="custom-image" :image="require('../assets/avatar/1.jpg')" description="没有你想学的课程？">
        <van-button plain type="warning" class="bottom-button">点此告诉我们</van-button>
      </van-empty>
    </div>
  </div>
</template>

<script>
import Vue from 'vue'
import { Lazyload } from 'vant'

Vue.use(Lazyload)
export default {
  data() {
    return {
      imgList: [
        // 描述图
        { img: require('../assets/avatar/1.jpg') },
        { img: require('../assets/avatar/1.jpg') },
        { img: require('../assets/avatar/1.jpg') },
        { img: require('../assets/avatar/1.jpg') },
        { img: require('../assets/avatar/1.jpg') },
        { img: require('../assets/avatar/1.jpg') },
        { img: require('../assets/avatar/1.jpg') },
        { img: require('../assets/avatar/1.jpg') },
        { img: require('../assets/avatar/1.jpg') },
        { img: require('../assets/avatar/1.jpg') },
      ],
      images: [
        // 轮播图
        'https://image.hongbeibang.com/FsPytummH00pZBaei_Mlt5vZlHdH?1380X700&imageView2/1/w/750/h/380',
        'https://image.hongbeibang.com/FsPytummH00pZBaei_Mlt5vZlHdH?1380X700&imageView2/1/w/750/h/380',
        'https://image.hongbeibang.com/FsPytummH00pZBaei_Mlt5vZlHdH?1380X700&imageView2/1/w/750/h/380',
        'https://image.hongbeibang.com/FsPytummH00pZBaei_Mlt5vZlHdH?1380X700&imageView2/1/w/750/h/380',
        'https://image.hongbeibang.com/FsPytummH00pZBaei_Mlt5vZlHdH?1380X700&imageView2/1/w/750/h/380',
      ],
    }
  },
}
</script>
<style>
/* 搜索框&分类导航外层 */
.home {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-content: center;
  top: 0;
  z-index: 9999;
  position: fixed;
  width: 100%;
}
/* 搜索框 */
.van-search {
    /* display: -webkit-box; */
    padding: 10px 17px;
    width: 100%;
}
/* 框内样式 */
.van-search__content {
    background-color: #f0f0ef;
    padding: 0 12px;
}
/* 搜索图标颜色 */
.van-cell{
  color: #999999;
}
/* 分类导航 */
.van-tabs { 
    position: relative;
    top: 0px;        /* 紧贴上面 */
    width: 100%;
}

/* 轮播 */
.lb {
  top: 99px;
  height: 156px;
  margin-bottom: 20px;
}
.lbz{
  display: flex;
  justify-content: center;
}
.lbtp{
  width: 100%; 
  height: 100%; 
  border-radius: 4px; 
  margin: 0 17px;
}


/* 后面主体 */
.zht {
  position: relative;
  top: 99px;
}

/* 横排展示 */
.van-tabs__line {
  /* position: absolute; */
  bottom: 21px;
  /* left: 0; */
  width: 20px;
  height: 3px;
  background-color: #ff3508;
  border-radius: 3px;
}

/* 去掉细线 */
/* 细线原因未知 */
.van-hairline--top-bottom::after{
  border-width: 0;
}
.van-cell::after {
  border-bottom: 0px solid #ffffff;
}


.tp {
  display: flex;
  overflow: auto;
  padding: 0 12px;
  margin-bottom:26px
}
/* 横排标题 */
.custom-title {
  font-size: 17px;
  color: #313131;
  vertical-align: middle;
  font-weight: bold;
}

/* 去掉下面滚动条 */
.tp::-webkit-scrollbar {
  display: none;
}

.ttp{
  margin: 0 5px;
  position: relative;
}
.ttp > img {
  border-radius: 4px;
  width: 164px;
}

/* 在学人数 */
.rs{
    position: absolute;
    left: 0;
    bottom: 54px;
    font-size: 11px;
    margin: 0 10px;
    padding: 2px 4px;
    border-radius: 2px;
    overflow: hidden;
    color: #4A4945;
    background-color: #fff;
}

/* 描述 */
.miaoshu {
  color: #4a4945;
  font-weight: bold;
  font-size: 15px;
  line-height: 20.25px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 空状态图片大小 */
.custom-image .van-empty__image {
  width: 60px;
  height: 50px;
}

/* 页尾按钮 */
.bottom-button {
  display: flex;
  justify-content: center;
  width: 134px;
  height: 36px;
  margin-top: -24px;
}
</style>
<style lang="scss" scoped></style>
